package com.sinodata.bsm.cicp.finder.tomcat;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.sinodata.bsm.cicp.finder.Finder;

public class ClassLoadFinder extends Finder {

    //private static final Logger logger = Logger.getLogger(ClassLoadFinder.class);

    /* @Override
     public List find(ResValue resValue, ResAttributeValValue[] attrVals, ResAttributeValue[] attributes) {
         List resources = new ArrayList();
         //        String ip = host;
         //        String port = attrVals[4].getAttrValue();
         //        MBeanServerConnection connection = JmxUtil.getConnection(JmxUtil.TOMCAT, ip + ":" + port);
         List oneResource = CreateOneResource("classLoading", attributes);
         resources.add(oneResource);
         logger.info("find tomcat classLoad");
         return resources;
     }*/

    /* private List CreateOneResource(String name, ResAttributeValue[] attributes) {
         List aRes = new ArrayList();
         ResValue res = new ResValue();
         res.setIp(host); // host IP address
         res.setInternalId(host + "_tomcatManager_" + name); // Internal ID for agent
         res.setName(name);
         aRes.add(res);
         ResAttributeValValue valValue = new ResAttributeValValue();
         valValue.setResAttributeId(attributes[0].getId());
         valValue.setAttrValue("classLoading");
         aRes.add(valValue);
         return aRes;
     }*/

    @SuppressWarnings("unchecked")
    @Override
    public List<String[]> find(String ip, Map params) {
        List<String[]> list = new ArrayList<String[]>();
        String name = "classLoading";
        String[] info = new String[4];
        list.add(info);
        info[0] = ip + "_tomcatManager_" + name;
        info[1] = name;
        info[2] = name;
        info[3] = "classLoading";
        return list;
    }
}
